<?php 
header('Content-type: text/html; charset=utf-8');
require_once dirname(__FILE__) . '/__config.php';
require_once dirname(__FILE__) . '/incls/php/miscutils.class.php';
require_once dirname(__FILE__) . '/incls/php/dbutils.class.php';
$myPdo = DbUtils::createPdoInst();

try {
  $mv_fds = scandir('J:/Movies');
  foreach ($mv_fds as $idx => &$mv_fd) {
    if ($mv_fd == '.' || $mv_fd == '..') {
      continue;
    }
    
    $cond_vals = new stdClass();
    $cond_vals->c = 't.folder = :v1';
    $cond_vals->v = array(':v1' => $mv_fd);
    $opt = new stdClass();
    $opt->select_expr = 'COUNT(t.id) AS total';
    $total = DbUtils::get($myPdo, 'pz2_mv', $cond_vals, NULL, NULL, NULL, NULL, $opt)->d[0]->total;
    if ($total >= 1) {
      continue;
    }
    
    MiscUtils::dump($idx . ' ' . $mv_fd);
//    MiscUtils::dump($mv_obj);
//    MiscUtils::dump('--------------------------------------------------------------------------------------------');

  }
} catch (PDOException $e) {
  MiscUtils::dump($e);
}

?>
